package org.zfes.snowier.cloud.zbss.cms.router.service.checkFlow;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.cms.checkFlow.model.CmsCheckFlowSteps;
import org.zfes.snowier.cloud.zbss.cms.checkFlow.service.ICmsCheckFlowStepsService;
@Controller 
@RequestMapping("/cms/checkFlow/cmsCheckFlowSteps")
public class CmsCheckFlowStepsController extends BaseController {

	
	@Autowired
	private ICmsCheckFlowStepsService cmsCheckFlowStepsService;
	
	@RequiresPermissions(value="cmsCheckFlowSteps:loadCmsCheckFlowStepsDataSet",desc="流程的步骤列表")
    @RequestMapping(value="/loadCmsCheckFlowStepsDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsCheckFlowStepsDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  cmsCheckFlowStepsService.loadCmsCheckFlowStepsDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	@RequiresPermissions(value="cmsCheckFlowSteps:createCmsCheckFlowSteps",desc="流程的步骤添加")
    @RequestMapping(value="/createCmsCheckFlowSteps", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createCmsCheckFlowSteps(CmsCheckFlowSteps cmsCheckFlowSteps){
		cmsCheckFlowStepsService.createCmsCheckFlowSteps(cmsCheckFlowSteps);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsCheckFlowSteps:loadCmsCheckFlowSteps",desc="流程的步骤加载")
    @RequestMapping(value="/loadCmsCheckFlowSteps", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsCheckFlowSteps(Long id){
		Optional<CmsCheckFlowSteps> ops = cmsCheckFlowStepsService.loadCmsCheckFlowStepsById(id);
		return ajaxQuery("cmsCheckFlowSteps",ops);
    }
	
	@RequiresPermissions(value="cmsCheckFlowSteps:updateCmsCheckFlowSteps",desc="流程的步骤更新")
    @RequestMapping(value="/updateCmsCheckFlowSteps", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updateCmsCheckFlowSteps(CmsCheckFlowSteps cmsCheckFlowSteps){
		cmsCheckFlowStepsService.updateCmsCheckFlowSteps(cmsCheckFlowSteps);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsCheckFlowSteps:deletCmsCheckFlowSteps",desc="流程的步骤删除")
    @RequestMapping(value="/deleteCmsCheckFlowSteps", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deleteCmsCheckFlowSteps(Long id){
		cmsCheckFlowStepsService.deleteCmsCheckFlowSteps(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}